package com.ccx.coachsite.ui.own;

import java.util.List;

import android.content.Context;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;

import com.ccx.coachsite.R;

public class OwerAddFriendView extends OwerBaseView{
	
	private List<String> mListLog;
	private ListView mLogList;
	private OwerAddFriendAdapter mOwerAddFriendAdapter;
	private View mNoneView;
	
	public OwerAddFriendView(Context context, OwerMainBase superView) {
		super(context, superView);
		loadData();
		
		mNoneView = findViewById(R.id.ower_add_friend_none_shared);
		mLogList = (ListView) findViewById(R.id.ower_add_friend_log_list);
		TextView txt = (TextView)mNoneView.findViewById(R.id.ower_none_title);
		txt.setText("您目前没有邀请好友的记录，赶快邀请吧");
	}
	
	protected boolean onLoadData() 
	{
		mListLog = OwerProvider.getInstance().getInviteLog(mContext);
		if (mListLog == null)
			return false;
		return true;
	}
	
	protected void doRefreshDataSuccess()
	{
		if(mListLog.size() == 0)
		{
			mNoneView.setVisibility(View.VISIBLE);
		}
		else
		{
			mLogList.setVisibility(View.VISIBLE);
			mOwerAddFriendAdapter = new OwerAddFriendAdapter(mContext,mListLog);
			mLogList.setAdapter(mOwerAddFriendAdapter);
		}
	}
}